package bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Component
// @Component("sb")
// @Repository
// @Service
// @Controller
// @Lazy
// @Scope("prototype")
public class SomeBean {

    // @Autowired
    // private OtherBean otherBean;

    // @Autowired
    // @Qualifier("ob")
    // private OtherBean otherBean;

    // @Resource
    // private OtherBean otherBean;

    @Resource(name="ob")
    private OtherBean otherBean;

    public void doSome(){
        System.out.println("SomeBean.doSome()");
    }

    public OtherBean getOtherBean() {
        return otherBean;
    }


    public SomeBean() {
        System.out.println("SomeBean.SomeBean()");
    }

    // @Autowired
    public void setOtherBean(OtherBean otherBean) {
        System.out.println("SomeBean.setOtherBean()");
        this.otherBean = otherBean;
    }
}
